package com.yx.cloud.map3d;

import android.content.Context;

import com.aaa.lib.map3d.obj.ModelData;
import com.aaa.lib.map3d.obj.MultiObj3D;
import com.aaa.lib.map3d.obj.ObjReader;

import java.util.HashMap;

public class ModelLoader {

    public static final int TYPE_POWER = 0;
    public static final int TYPE_SWEEPER = 1;

    private HashMap<String,ModelData> modelPool;

    private ModelLoader() {
        modelPool = new HashMap<>();
    }

    public static ModelLoader getInstance() {
        return InstanceHolder.instance;
    }

    public MultiObj3D loadModel(Context context, String path) {
        MultiObj3D obj = ObjReader.readMultiObj(context, path);
        modelPool.put(path, obj);
        return obj;
    }



    public ModelData getModelDataByName(String name){
        ModelData modelData=modelPool.get(name);
        return modelData;
    }

    private static class InstanceHolder {
        static ModelLoader instance = new ModelLoader();
    }
}
